package com.cn.jx.manager.po;

import static com.jx.util.CodeUtil.getRandomId;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.cn.jx.common.entity.BaseIdEntity;
import org.springframework.data.annotation.CreatedDate;

import com.jx.enumType.OperatEnum;

/**
 * <p>SystemOperation 数据操作记录表POJO类 对应数据库表名 SYS_OPERATION_LOG
 * <p>实现<{@link Serializable <tt>序列化接口</tt>}
 * <p>实现<{@link BaseIdEntity <tt>BaseIdEntity</tt>}
 *  
 * @author <h1>jiangxu2  2019年11月21日</h1>
 * @version v1.11.20.2019
 * @since 1.0
 * 
 */
@Entity
@Table(name="SYS_OPERATION_LOG")
public class SystemOperation extends BaseIdEntity {

	private static final long serialVersionUID = 4755199623492019230L;

	/** <p>操作时间<p>设置为{@link Date Date}类型*/
	@Temporal(TemporalType.TIMESTAMP)//设置为时间类型
	@Column(name="operat_time")
	@CreatedDate
	private Date operatTime;
	
	/** <p>操作人<p>设置为{@link String String}类型*/
	@Column(name="operat_user",length=64)
	private String operatUser;
	
	/** <p>操作类型 删除 修改 更新<p>设置为{@link String String}类型*/
	@Column(name="operat_type",length=64)
	private String operatType;
	
	/** <p>操作描述<p>设置为{@link String String}类型*/
	@Column(name="operat_desc",length=512)
	private String operatDesc;
	
	/** <p>操作表<p>设置为{@link String String}类型*/
	@Column(name="opert_table",length=64)
	private String opertTable;
	
	/** <p>操作表的数据ID<p>设置为{@link String String}类型*/
	@Column(name="table_id",length=512)
	private String tableId;
	
	/** <p>初始化创建类 @return */
	public static SystemOperation getInstance(Class<?> table,String id,OperatEnum operType,String operUser,String desc){
		SystemOperation m=new SystemOperation();
		m.setId(getRandomId());
		m.setOperatTime(new Date());
		m.setOpertTable(table.getSimpleName());
		m.setTableId(id);
		m.setOperatType(operType.name());
		m.setOperatUser(operUser);
		m.setOperatDesc("您执行了"+desc+"功能");
		return m;
	}

	/** <p>{@link Date Date}<p>getOperatTime()*/
	public Date getOperatTime() {
		return operatTime;
	}
	/** <p>{@link String String}<p>getOperatUser()*/
	public String getOperatUser() {
		return operatUser;
	}
	/** <p>{@link String String}<p>getOperatType()*/
	public String getOperatType() {
		return operatType;
	}
	/** <p>{@link String String}<p>getOperatDesc()*/
	public String getOperatDesc() {
		return operatDesc;
	}
	/** <p>{@link String String}<p>getOpertTable()*/
	public String getOpertTable() {
		return opertTable;
	}
	/** <p>{@link String String}<p>getTableId()*/
	public String getTableId() {
		return tableId;
	}
	
	/** <p>setOperatTime({@link Date operatTime})*/
	public void setOperatTime(Date operatTime) {
		this.operatTime = operatTime;
	}
	/** <p>setOperatUser({@link String operatUser})*/
	public void setOperatUser(String operatUser) {
		this.operatUser = operatUser;
	}
	/** <p>setOperatType({@link String operatType})*/
	public void setOperatType(String operatType) {
		this.operatType = operatType;
	}
	/** <p>setOperatDesc({@link String operatDesc})*/
	public void setOperatDesc(String operatDesc) {
		this.operatDesc = operatDesc;
	}
	/** <p>setOpertTable({@link String opertTable})*/
	public void setOpertTable(String opertTable) {
		this.opertTable = opertTable;
	}
	/** <p>setTableId({@link String tableId})*/
	public void setTableId(String tableId) {
		this.tableId = tableId;
	}
}
